﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using BGSpaceShooter;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace ParticleSystem
{
    /// <summary>
    /// Klasa pomocnicza renderująca efekty cząsteczkowe do tekstury
    /// </summary>
    public class ParticleEffectTexturer
    {
        /// <summary>
        /// Inicjalizacja
        /// </summary>
        public ParticleEffectTexturer()
        {

        }

        public void Draw(GraphicsDevice graphicsDevice, List<GameObject> gameObjects, Camera camera, Matrix projection, GameTime gameTime)
        {
            graphicsDevice.DepthStencilState = DepthStencilState.DepthRead;
            graphicsDevice.RasterizerState = RasterizerState.CullNone;

            graphicsDevice.BlendState = BlendState.AlphaBlend;

            foreach (GameObject gameObject in gameObjects)
            {
                foreach (IObjectEffect objectEffect in gameObject.GetEffectsToDraw())
                {
                    objectEffect.GetDrawer().Draw(camera);
                }
            }

            graphicsDevice.DepthStencilState = DepthStencilState.Default;
        }
    }
}
